<template>
	<view class="content">
		<u-sticky bgColor="#fff" :offsetTop="0" :customNavHeight="0">
			<u-tabs :list="list" :scrollable="false" :current="current" @click="seletTab"></u-tabs>
		</u-sticky>
		<!-- <view style="background-color: #fff;">
			<u-tabs :list="list" :scrollable="false" :current="current" @click="seletTab"></u-tabs>
		</view> -->
		<view class="depart-con">
			<view class="depart-list" v-for="(item,index) in dataList" :key="index" @click="goPage(item)">
				{{item.name}}
			</view>
		</view>
	</view>
</template>

<script>
	import {
		departmentInfoApi
	} from "@/api/user"
	export default {
		data() {
			return {
				dataList: [],
				current: 0,
				deptType: 1,
				list: [{
						name: '临床',
						type: 1
					},
					{
						name: '医技',
						type: 2
					},

				]
			}
		},
		onLoad() {
			this.getList()
		},
		methods: {
			async getList() {
				uni.showLoading({
					title: '加载中...',
					mask: true
				})
				try {
					const res = await departmentInfoApi({
						deptType: this.deptType
					})

					this.dataList = res.data
					uni.hideLoading()
				} catch (e) {
					uni.hideLoading()
				}
			},
			seletTab(e) {
				this.deptType = e.type
				this.dataList = []
				this.getList()
			},
			goPage(item) {
				uni.navigateTo({
					url: '/pages/hospitaldepartmentdesc/hospitaldepartmentdesc?detail=' + item.detail

				})
			}
		}
	}
</script>

<style scoped>
	.content {
		width: 100vw;
		min-height: 100%;
		box-sizing: border-box;
		background: #F8F8F8;
		color: #666666;
		font-size: 27rpx;
		padding-bottom: calc(23rpx + env(safe-area-inset-bottom));
		box-sizing: border-box;
	}

	.depart-con {
		margin-left: 31rpx;
		display: flex;
		flex-wrap: wrap;
		margin-top: 23rpx;
	}

	.depart-list {
		width: 215rpx;
		height: 96rpx;
		background: #FFFFFF;
		border-radius: 10rpx;
		padding: 0 15rpx;
		box-sizing: border-box;
		margin-bottom: 23rpx;
		margin-right: 21rpx;
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;

	}
</style>